package cn.com.lsjz.nursemanager.repository.system;

import java.util.List;

import org.springframework.data.jpa.repository.Query;

import cn.com.lsjz.commons.repository.base.BaseRepository;
import cn.com.lsjz.nursemanager.model.system.SysDept;


public interface SysDeptRepository extends BaseRepository<SysDept, Integer> {
	
	/**
	 * 根据用户ID返回对应的科室权限信息
	 * @param userId
	 * @return
	 */
	@Query("select d from SysDept d,SysUserVsDept ud,SysUser "
			+ "u where d.deptCode = ud.deptCode and ud.userId = u.userId"
			+ " and u.userId = ?1 order by d.deptCode")
	List<SysDept> loadByUserId(String userId);
	
	/**
	 * 根据科室名称模糊搜索科室列表
	 * @param deptName
	 * @return
	 */
	List<SysDept> getByDeptNameContaining(String deptName);
	
}
